from selenium import webdriver
from pprint import  pprint
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
#操作cookie
# driver.get_cookies()
# pprint(driver.get_cookies())
# # driver.get_cookie(name)
# print(driver.get_cookie("ZFY"))
# # driver.add_cookie(cookie_dict)#添加cookle必须有建和值
# dict1 = {"name": 'hello', 'value': '111111'}
# driver.add_cookie(dict1)
# pprint(driver.get_cookies())
#
# driver.delete_cookie('hello')
# pprint(driver.get_cookies())
# driver.delete_all_cookies()
# pprint(driver.get_cookies())
#
# driver.quit()
driver.get_cookies()
# pprint(driver.get_cookies())
print(driver.get_cookie('ZFY'))
dict1 = {'name': '18', 'value': '朱梓鑫'}
driver.add_cookie(dict1)
pprint(driver.get_cookies())
driver.quit()





